package com.cn.data.proxy.jdk.natives;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: chenl
 * @Date: 2019/12/27 0:06
 */
public class CustomProxyInvocationHandler implements InvocationHandler {

    Object target;

    public CustomProxyInvocationHandler(Object target){
        this.target = target;
    }

    /**
     *
     * @param proxy
     * @param method
     * @param args
     * @return
     * @throws Throwable
     */
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("===代理逻辑===");
        return method.invoke(target, args);
    }
}
